<?php
namespace app\servercoding\logic;

use \app\manage\logic\BaseLogic;

/**
 * @author:      李颖
 * @DateTime:    
 * @Description: 获取编码
 */
class Coding extends BaseLogic
{
    //获取单个编码 获取亚数或艺货的
    public function getCoding($data): array 
    {
        $codingConfig = config('coding');
        $action = $codingConfig[$data['app_id']][$data['type']];
        if(function_exists($action)){
            $coding = $action(0);
            return auto_return($coding, '成功获取编码');
        }else{
            return auto_failure(null, '调用方法不存在');
        }

    }
    /*根据不同的id获取相应的编码*/
    public function getCodingByIds($data): array 
    {
        $codingConfig = config('coding');
        $action = $codingConfig[$data['app_id']][$data['type']];
        if(function_exists($action)){
            $coding = $action($data['count']);
            return auto_return($coding, '成功获取编码');
        }else{
            return auto_failure(null, '调用方法不存在');
        }
    }
 



}